package com.itheima.principles.demo2.after;



/**
 * 李氏代换原则
 */
public class RectangleDemo {
    public static void main(String[] args) {
        Rectangle rectangle = new Rectangle();
        rectangle.setLength(20);
        rectangle.setWidth(10);
        resize(rectangle);
        printLengthAndWidth(rectangle);

        System.out.println("=======================");

    }

    //扩宽方法
    public static void resize(Rectangle rectangle){
        //判断宽比长小，进行扩宽操作
        while (rectangle.getWidth()<=rectangle.getLength()){

            rectangle.setWidth(rectangle.getWidth()+1);

        }
    }


    //打印常和宽
    public static void printLengthAndWidth(Quadrilateral quadrilateral){
        System.out.println(quadrilateral.getLength());
        System.out.println(quadrilateral.getWidth());
    }
}
